{% extends 'base.html' %}
{% block title %}
    <title>index</title>
{% endblock %}

{% block extcss %}
    <link rel="stylesheet" href="../static/css/index.css">
{% endblock %}

{% block head %}
    <div class="head w">
        <div class="nav w">
            <div class="logo">
                <h2><a href="/index/">职工工资管理系统</a></h2>
            </div>
            <div class="login">
                <ul>
                {% if user %}
                    <li><a href="/user/">{{ user.username }}</a></li>
                    <li><a href="/user/logout/">退出登录</a></li>
                {% else %}
                    <li><a href="/login/">登录</a></li>
                    <li><a href="/register/">注册</a></li>
                {% endif %}
                </ul>
            </div>
        </div>
    </div>
{% endblock %}

{% block body %}
    <div class="box1">
        <div class="box2">
            <div class="box3">
                <table>
                    <thead>
                        <tr>
                            <th>姓名</th>
                            <th>部门</th>
                            <th>职位</th>
                            <th>基本工资</th>
                            <th>加班时长</th>
                            <th>总工资</th>
                        </tr>
                    </thead>
                    <tbody>
                    {% for user in p.items %}
                        <tr>
                            <td>{{ user.name }}</td>
                            <td>{{ user.department.name }}</td>
                            <td>{{ user.job.name }}</td>
                            <td>{{ user.department.wages + user.job.wages }}</td>
                            <td>{{ user.overtime }}</td>
                            <td>{{ "%.2f"|format(( user.department.wages + user.job.wages ) * ( Decimal(0.01) * user.overtime + Decimal(1) ))}}</td>
                        </tr>
                    </tbody>
                    {% endfor %}
                </table>
            </div>
            <div class="box4">
                <ul>
                    {% if p.page > 1 %}
                    	<li><a href="{{ p.page - 1 }}">上一页</a></li>
                        {% else %}
                        <li><a href="">上一页</a></li>
                    {% endif %}
                    <li><a href="#"></a>{{ p.page }}</li>
                    {% if p.pages > p.page %}
                    	<li><a href="{{ p.page + 1 }}">下一页</a></li>
                    {% else %}
                        <li><a href="">下一页</a></li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </div>
{% endblock %}

{% block foot %}
{% endblock %}